import LoggerAPI
import Health
import KituraContracts

func initializeHealthRoutes(app: App) {
    
    app.router.get("/health") { (respondWith: (Status?, RequestError?) -> Void) -> Void in
        if health.status.state == .UP {
            respondWith(health.status, nil)
        } else {
            respondWith(nil, RequestError(.serviceUnavailable, body: health.status))
        }
    }
    app.router.get("/Hello") { request, response, next in
        response.send("Hello From the 1 router\n")
        next()
    }
    app.router.get("/Hello") { request, response, next in
        response.send("Hello From the 2 router\n")
        next()
    }
    app.router.get("/Hello") { request, response, next in
        response.send("Hello From the 3 router\n")
        next()
    }
    app.router.get("/Mac") { (request,response,next) in
        response.send("Mac")
        next()
    }
    
    
    func getHandler(completion: ([String]?, RequestError?) -> Void) {
        completion(["Mac1","Mac2"], nil)
    }
    
    app.router.get("/wantMac", handler: getHandler)
    
}
